# from parameterized import parameterized
#
# from common.assert_util import TestIhrmAssert
# from api.ihrm_login_api import IhrmLoginApi
# from config import BASE_DIR
# from common.ihrm_read_data import Read_data
#
#
# class TestLogin:
#     login_path = BASE_DIR +'/data/ihrm_data.json'
#     @parameterized.expand(Read_data.read_data(login_path))
#     def test_login(self,body,status_code,success,code,message):
#         resp = IhrmLoginApi.login_api(body)
#         TestIhrmAssert.ihrm_assert(resp,status_code,success,code,message)
import assert_util
import config
from parameterized import parameterized
#
from api.ihrm_manage_emp_api import IHRMMangeEmpApi
from common import token_util, db_util
from common.ihrm_read_data import Read_data


class TestAdd_emp:
    #类前置
    def setup_class(self):
        self.token =token_util.TokenUtil.token_get()
    #方法前置
    def setup(self):
        del_sql =f'delete from bs_user where mobile ="{config.TEL}"'
        db_util.DBUtil.uid_db(del_sql)
    #方法后置
    def teardown(self):
        del_sql =f'delete from bs_user while mobile ="{config.TEL}"'
        db_util.DBUtil.uid_db(del_sql)
    add_path =config.BASE_DIR +'/data/ihrm_add_emp.json'
    @parameterized.expand(Read_data.read_data(add_path))
    def test_add_emp(self,body,status_code,success,code,message):
        resp =IHRMMangeEmpApi.add_emp(self.token,body)
        assert_util.TestIhrmAssert.ihrm_assert(resp,status_code,success,code,message)